/*
 * THE SOURCE CODES OF THE SOFTWARE ARE VALUABLE ASSETS OF FIDUS TECHNOLOGIES LTD.
 * YOU AGREE TO KEEP ALL SOURCE CODES OF THE SOFTWARE IN CONFIDENCE. YOU MAY NOT TRANSFER
 * OR ASSIGN THE SOFTWARE OR YOUR RIGHTS UNDER THIS AGREEMENT.
 * LIMITED WARRANTY
 * THE SOFTWARE AND ACCOMPANYING WRITTEN MATERIALS (INCLUDING INSTRUCTIONS FOR USE) ARE PROVIDED "AS IS"
 * AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU ASSUME THE ENTIRE
 * RISK AS TO THE RESULTS AND PERFORMANCE OF THE SOFTWARE.
 * FIDUS TECHNOLOGIES DOES NOT WARRANT THAT THE SOFTWARE WILL MEET ALL YOUR REQUIREMENTS, THAT OPERATIONS
 * OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL SOFTWARE ERRORS WILL BE CORRECTED.
 * FIDUS TECHNOLOGIES-SOFTWARE SOLUTIONS IS NOT RESPONSIBLE FOR PROBLEMS CAUSED BY CHANGES IN THE
 * OPERATING CHARACTERISTICS OF COMPUTER HARDWARE OR COMPUTER OPERATING SYSTEMS WHICH ARE MADE AFTER
 * WHICH ARE MADE AFTER THE RELEASE OF THE SOFTWARE NOR FOR PROBLEMS IN THE INTERACTION OF THE SOFTWARE
 * WITH NON-FIDUS TECHNOLOGIES APPLICATION.WILL HAVE NO RESPONSIBILITY TO REPLACE OR REFUND THE LICENSE FEES
 * FOR MEDIA DAMAGED BY ACCIDENT, ABUSE OR MISAPPLICATION. THIS SOFTWARE IS INTENDED FOR COMMERCIAL,
 * INSTITUTIONAL, AND INDUSTRIAL USERS. THE ABOVE WARRANTIES ARE EXCLUSIVE AND IN LIEU OF ALL OTHER WARRANTIES,
 * WHETHER EXPRESSED OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NON-INFRINGEMENT. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY FIDUS TECHNOLOGIES,
 * ITS EMPLOYEES, DISTRIBUTORS, DEALERS OR AGENTS SHALL INCREASE THE SCOPE OF THE ABOVE WARRANTIES OR
 * CREATE ANY NEW WARRANTIES. NEITHER FIDUS TECHNOLOGIES NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE
 * CREATION, PRODUCTION OR DELIVERY OF THE SOFTWARE SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL
 * OR INCIDENTAL DAMAGES (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS LOSSES, BUSINESS
 * INTERRUPTION, LOSS OF DATA, AND THE LIKE) ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE,
 * OR ANY OTHER CLAIM BY ANY PARTY EVEN IF FIDUS TECHNOLOGIES HAS BEEN ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGES. IN THE EVENT FIDUS TECHNOLOGIES IS LIABLE FOR ANY DAMAGES, FIDUS TECHNOLOGIES' LIABILITY
 * FOR DAMAGES SHALL BE LIMITED TO THE AMOUNT PAID FOR THE SOFTWARE UNDER THE TERMS AND CONDITIONS OF THIS
 * AGREEMENT.
 * http://www.fidustechnologies.com
 * Copyright(C) 2010 FIDUS TECHNOLOGIES-Software Solutions(R)
 * All rights reserved.
 */

/*
 * SearchCustomer.java
 *
 * Created on 7 Sep, 2010, 2:40:40 PM
 */

package com.fidus.inventory.UI.customer;

import com.fidus.inventory.beans.customer.CustomerDetails;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.List;
import javax.persistence.Query;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.jdesktop.application.Action;

/**
 *
 * @author Mahesh Kedari<mahesh.kedari@fidustechnologies.com>
 */
public class SearchCustomer extends javax.swing.JPanel {

    /** Creates new form SearchCustomer */
    public SearchCustomer() {
        initComponents();

        /*
         * If selection is changed in table, fire change listener and modify
         * value of customerSelected property
         */
        customersTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent lse) {
                propertyChangeSupport.firePropertyChange(PROP_CUSTOMERSELECTED, isCustomerSelected(), !isCustomerSelected());
            }
        });
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("inventorymanagement_dbPU").createEntityManager();
        customerDetailsQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT c FROM CustomerDetails c");
        customerDetailsList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(customerDetailsQuery.getResultList());
        customerPopup = new javax.swing.JPopupMenu();
        refreshMenuItem = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        viewMenuItem = new javax.swing.JMenuItem();
        deleteMenuItem = new javax.swing.JMenuItem();
        newMenuItem = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        salesOrderMenuItem = new javax.swing.JMenuItem();
        quotationMenuItem = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        paymentsMenu = new javax.swing.JMenu();
        viewPaymentsMenuItem = new javax.swing.JMenuItem();
        newPaymentMenuItem = new javax.swing.JMenuItem();
        searchPanel = new org.jdesktop.swingx.JXTitledPanel();
        searchForLabel = new javax.swing.JLabel();
        searchForTextField = new javax.swing.JTextField();
        searchTypeLabel = new javax.swing.JLabel();
        searchTypeComboBox = new javax.swing.JComboBox();
        matchTypeLabel = new javax.swing.JLabel();
        matchTypeComboBox = new javax.swing.JComboBox();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        customersTable = new org.jdesktop.swingx.JXTable();

        customerPopup.setName("customerPopup"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(simple_inventory.Simple_InventoryApp.class).getContext().getResourceMap(SearchCustomer.class);
        refreshMenuItem.setText(resourceMap.getString("refreshMenuItem.text")); // NOI18N
        refreshMenuItem.setName("refreshMenuItem"); // NOI18N
        customerPopup.add(refreshMenuItem);

        jSeparator1.setName("jSeparator1"); // NOI18N
        customerPopup.add(jSeparator1);

        viewMenuItem.setText(resourceMap.getString("viewMenuItem.text")); // NOI18N
        viewMenuItem.setName("viewMenuItem"); // NOI18N
        customerPopup.add(viewMenuItem);

        deleteMenuItem.setText(resourceMap.getString("deleteMenuItem.text")); // NOI18N
        deleteMenuItem.setName("deleteMenuItem"); // NOI18N
        customerPopup.add(deleteMenuItem);

        newMenuItem.setText(resourceMap.getString("newMenuItem.text")); // NOI18N
        newMenuItem.setName("newMenuItem"); // NOI18N
        customerPopup.add(newMenuItem);

        jSeparator2.setName("jSeparator2"); // NOI18N
        customerPopup.add(jSeparator2);

        salesOrderMenuItem.setText(resourceMap.getString("salesOrderMenuItem.text")); // NOI18N
        salesOrderMenuItem.setName("salesOrderMenuItem"); // NOI18N
        customerPopup.add(salesOrderMenuItem);

        quotationMenuItem.setText(resourceMap.getString("quotationMenuItem.text")); // NOI18N
        quotationMenuItem.setName("quotationMenuItem"); // NOI18N
        customerPopup.add(quotationMenuItem);

        jSeparator3.setName("jSeparator3"); // NOI18N
        customerPopup.add(jSeparator3);

        paymentsMenu.setText(resourceMap.getString("paymentsMenu.text")); // NOI18N
        paymentsMenu.setName("paymentsMenu"); // NOI18N

        viewPaymentsMenuItem.setText(resourceMap.getString("viewPaymentsMenuItem.text")); // NOI18N
        viewPaymentsMenuItem.setName("viewPaymentsMenuItem"); // NOI18N
        paymentsMenu.add(viewPaymentsMenuItem);

        newPaymentMenuItem.setText(resourceMap.getString("newPaymentMenuItem.text")); // NOI18N
        newPaymentMenuItem.setName("newPaymentMenuItem"); // NOI18N
        paymentsMenu.add(newPaymentMenuItem);

        customerPopup.add(paymentsMenu);

        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(237, 593));

        searchPanel.setTitle(resourceMap.getString("searchPanel.title")); // NOI18N
        searchPanel.setName("searchPanel"); // NOI18N

        searchForLabel.setLabelFor(searchForTextField);
        searchForLabel.setText(resourceMap.getString("searchForLabel.text")); // NOI18N
        searchForLabel.setName("searchForLabel"); // NOI18N

        searchForTextField.setText(resourceMap.getString("searchForTextField.text")); // NOI18N
        searchForTextField.setName("searchForTextField"); // NOI18N

        searchTypeLabel.setLabelFor(searchTypeComboBox);
        searchTypeLabel.setText(resourceMap.getString("searchTypeLabel.text")); // NOI18N
        searchTypeLabel.setName("searchTypeLabel"); // NOI18N

        searchTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Name", "Description" }));
        searchTypeComboBox.setName("searchTypeComboBox"); // NOI18N

        matchTypeLabel.setLabelFor(matchTypeComboBox);
        matchTypeLabel.setText(resourceMap.getString("matchTypeLabel.text")); // NOI18N
        matchTypeLabel.setName("matchTypeLabel"); // NOI18N

        matchTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Contains", "Exact" }));
        matchTypeComboBox.setName("matchTypeComboBox"); // NOI18N

        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(simple_inventory.Simple_InventoryApp.class).getContext().getActionMap(SearchCustomer.class, this);
        jButton2.setAction(actionMap.get("clearForm")); // NOI18N
        jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N
        jButton2.setName("jButton2"); // NOI18N

        javax.swing.GroupLayout searchPanelLayout = new javax.swing.GroupLayout(searchPanel.getContentContainer());
        searchPanel.getContentContainer().setLayout(searchPanelLayout);
        searchPanelLayout.setHorizontalGroup(
            searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(searchPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(searchTypeLabel)
                    .addComponent(searchForLabel)
                    .addComponent(matchTypeLabel)
                    .addGroup(searchPanelLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(jButton1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(searchTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 118, Short.MAX_VALUE)
                    .addComponent(matchTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 118, Short.MAX_VALUE)
                    .addGroup(searchPanelLayout.createSequentialGroup()
                        .addComponent(jButton2)
                        .addGap(19, 19, 19))
                    .addComponent(searchForTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE))
                .addContainerGap())
        );
        searchPanelLayout.setVerticalGroup(
            searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(searchPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(searchForLabel)
                    .addComponent(searchForTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(searchTypeLabel)
                    .addComponent(searchTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(matchTypeLabel)
                    .addComponent(matchTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2)))
        );

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        customersTable.setColumnSelectionAllowed(true);
        customersTable.setName("customersTable"); // NOI18N

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, customerDetailsList, customersTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${customerName}"));
        columnBinding.setColumnName("Customer Name");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${description}"));
        columnBinding.setColumnName("Description");
        columnBinding.setColumnClass(String.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane1.setViewportView(customersTable);
        customersTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        customersTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("customersTable.columnModel.title0")); // NOI18N
        customersTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("customersTable.columnModel.title1")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(searchPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(searchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE))
        );

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.util.List<com.fidus.inventory.beans.customer.CustomerDetails> customerDetailsList;
    private javax.persistence.Query customerDetailsQuery;
    private javax.swing.JPopupMenu customerPopup;
    private org.jdesktop.swingx.JXTable customersTable;
    private javax.swing.JMenuItem deleteMenuItem;
    private javax.persistence.EntityManager entityManager;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JComboBox matchTypeComboBox;
    private javax.swing.JLabel matchTypeLabel;
    private javax.swing.JMenuItem newMenuItem;
    private javax.swing.JMenuItem newPaymentMenuItem;
    private javax.swing.JMenu paymentsMenu;
    private javax.swing.JMenuItem quotationMenuItem;
    private javax.swing.JMenuItem refreshMenuItem;
    private javax.swing.JMenuItem salesOrderMenuItem;
    private javax.swing.JLabel searchForLabel;
    private javax.swing.JTextField searchForTextField;
    private org.jdesktop.swingx.JXTitledPanel searchPanel;
    private javax.swing.JComboBox searchTypeComboBox;
    private javax.swing.JLabel searchTypeLabel;
    private javax.swing.JMenuItem viewMenuItem;
    private javax.swing.JMenuItem viewPaymentsMenuItem;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    //<editor-fold defaultstate="collapsed" desc="Search Panel buttons Action Handling">
    /**
     * This action Searches Customer with selected criteria.
     */
    @Action
    public void searchCustomer(){
        /* Check for search type */
        int searchType = searchTypeComboBox.getSelectedIndex();
        /* Check if exact match is selected */
        boolean  exactMatch = (matchTypeComboBox.getSelectedIndex()==1);
        /* Get Seach Token */
        String searchToken =  searchForTextField.getText();

        
    }

    /**
     * This action resets the search panel and retrieves customers list with
     * no criteria
     */
    @Action
    public void clearForm(){
        Query query = entityManager.createNamedQuery("CustomerDetails.findAll");
        customerDetailsList.removeAll(customerDetailsList);
        List<CustomerDetails> tempList = query.getResultList();
        customerDetailsList.addAll(tempList);
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Popup menu action handling">
    
    /**
     * This action resets the customer list.
     */
    @Action
    public void refresh(){
        //TODO Refresh action for search customer
    }

    protected boolean customerSelected;
    public static final String PROP_CUSTOMERSELECTED = "customerSelected";

    /**
     * Get the value of customerSelected
     *
     * @return the value of customerSelected
     */
    public boolean isCustomerSelected() {
        return customersTable.getSelectedRow()!=-1;
    }

    /**
     * Set the value of customerSelected
     *
     * @param customerSelected new value of customerSelected
     */
    public void setCustomerSelected(boolean customerSelected) {
        boolean oldCustomerSelected = this.customerSelected;
        this.customerSelected = customerSelected;
        propertyChangeSupport.firePropertyChange(PROP_CUSTOMERSELECTED, oldCustomerSelected, customerSelected);
    }

    /**
     * This action views selected customer details
     */
    @Action(enabledProperty=PROP_CUSTOMERSELECTED)
    public void viewDetails(){
        //TODO View selected customer details
    }

    /**
     * This action will delete selected customer and reset the customer list
     */
    @Action(enabledProperty=PROP_CUSTOMERSELECTED)
    public void deleteCustomer(){
        //TODO Delete selected customer and reset customer List
    }

    /**
     * This action will navigate user to create new customer.
     */
    @Action
    public void newCustomer(){
        //TODO Create new customer
    }

    /**
     * This action will navigate user to new sales order screen with current
     * selected customer as a customer in new sales screen.
     */
    @Action(enabledProperty=PROP_CUSTOMERSELECTED)
    public void newSalesOrder(){
        //TODO New Sales order for selected customer
    }

    /**
     * This action will navigate user to new Quotation screen with current
     * selected customer as a customer in Quotation screen.
     */
    @Action(enabledProperty=PROP_CUSTOMERSELECTED)
    public void newQuotation(){
        //TODO New quotation for selected customer
    }

    /**
     * This action will show user, payment history of current selected customer.
     */
    @Action(enabledProperty=PROP_CUSTOMERSELECTED)
    public void viewPaymentHistory(){
        //TODO View payments history for selected customer
    }

    /**
     * This action will Initiate new payment for selected customer
     */
    @Action(enabledProperty=PROP_CUSTOMERSELECTED)
    public void newPayment(){
        //TODO Initiate new payment for selected customer
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Property Change Support">
    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    /**
     * Add PropertyChangeListener.
     *
     * @param listener
     */
    @Override
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }

    /**
     * Remove PropertyChangeListener.
     *
     * @param listener
     */
    @Override
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }
    //</editor-fold>

}
